﻿Imports PackageIO
Public Class Form1
    Dim FilePath As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Office2007StartButton1.Enabled = False
        ButtonItem13.Enabled = False
        ButtonItem32.Enabled = False
        ButtonItem1.Enabled = False
        GroupPanel1.Visible = True
        MsgBox("You must register to use this program! Once you have registered you can use some of the features! Purchase the Full Version of Instant Mods for all mods and features and it only cost $3 Canadian!", MsgBoxStyle.Information)
    End Sub

    Private Sub ButtonX2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX2.Click
        Form3.Show()
    End Sub

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        Try
            Dim checkUsername As String
            Dim checkPassword As String
            Dim a As New System.IO.StreamReader(Application.StartupPath & "\Accounts\" + TextBoxX1.Text + "\Username.txt")
            checkUsername = a.ReadLine()
            a.Close()
            Dim b As New System.IO.StreamReader(Application.StartupPath & "\Accounts\" + TextBoxX1.Text + "\Password.txt")
            checkPassword = b.ReadLine
            b.Close()
            If TextBoxX1.Text = checkUsername.ToString Then
                If TextBoxX2.Text = checkPassword.ToString Then
                    MsgBox("You are now logged in!")
                    Office2007StartButton1.Enabled = True
                    ButtonItem13.Enabled = True
                    ButtonItem32.Enabled = True
                    ButtonItem1.Enabled = True
                    GroupPanel1.Enabled = True
                Else
                    MsgBox("Incorrect Password!")
                End If
            Else
                MsgBox("Account does not exist!")
            End If
        Catch ex As Exception
            MsgBox("Error" + ex.Message)
        End Try
    End Sub

    Private Sub ButtonItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem13.Click
        Form9.Show()
    End Sub

    Private Sub ButtonItem12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem12.Click
        Form9.Show()
    End Sub

    Private Sub ButtonItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem6.Click
        Form5.Show()
    End Sub

    Private Sub ButtonItem29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem29.Click
        Form10.Show()
    End Sub

    Private Sub ButtonItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem9.Click
        Form2.Show()
    End Sub

    Private Sub ButtonItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem10.Click
        Form4.Show()
    End Sub

    Private Sub ButtonItem30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem30.Click
        Form7.Show()
    End Sub

    Private Sub ButtonItem31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem31.Click
        Form8.Show()
    End Sub

    Private Sub ButtonItem33_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem33.Click
        Form6.Show()
    End Sub

    Private Sub ButtonItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem1.Click
        Try

            Dim Open As New OpenFileDialog
            Open.ShowDialog()
            FilePath = Open.FileName
            ReadFile()
        Catch ex As Exception
        End Try
       
    End Sub
    Private Sub ReadFile()
        Dim Reader As New PackageIO.Reader(FilePath, PackageIO.Endian.Big)
        Reader.Position = &HD980
        TextBox1.Text = Reader.ReadInt32
    End Sub

    Private Sub ButtonItem14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem14.Click
        Try

            Dim Open As New OpenFileDialog
            Open.Title = "Open A Paintball 2009 Gamesave"
            Open.ShowDialog()
            FilePath = Open.FileName
            ReadFile()
        Catch ex As Exception
        End Try
    End Sub

    Private Sub ButtonX3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX3.Click
        Try
            OpenFileDialog1.Title = "Open Picture"
            OpenFileDialog1.FileName = ".jpg"
            OpenFileDialog1.Filter = "All Files |*.*"
            OpenFileDialog1.ShowDialog()
            PictureBox1.Image = System.Drawing.Image.FromFile(OpenFileDialog1.FileName)
        Catch ex As Exception
            'Do Nothing
        End Try
    End Sub

    Private Sub ButtonX4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX4.Click
        My.Settings.Picture = OpenFileDialog1.FileName
        My.Settings.Save()
    End Sub

    Private Sub ButtonX6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX6.Click
        GroupPanel1.Hide()
    End Sub

    Private Sub ButtonItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem2.Click
        GroupPanel1.Visible = True

    End Sub

    Private Sub ButtonItem34_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem34.Click
        Form11.Show()
        MsgBox("Once you have purchased the key you can message me on youtube at colbywhittle1 and I will check to make sure you payed and i will send you the key!", MsgBoxStyle.Information)

    End Sub

    Private Sub ButtonItem35_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem35.Click
        Form12.Show()
    End Sub
End Class
